﻿import com.dinmax.isolution.*

class AppButtonGUI
extends MovieClip {
	
	//movies de dibujo
	
	private var listener:ButtonBarGUI;
	private var window:String;
	private var _enabled:Boolean;
	
	function AppButtonGUI(){
		//trace("new AppButtonGUI");
		return;
	}
	
	function onLoad():Void {
		this.listener = ButtonBarGUI(this._parent);
		this.listener.registerChild(this);
		return;
	}
	
	public function onPress():Void {
		this.setEnabled(!this._enabled);
		return;
	}
	
	public function getEnabled():Boolean {
		return this._enabled;
	}
	
	public function setEnabled(b:Boolean):Void {
		this._enabled = b;
		
		if(this._enabled) {
			this.listener.onChange(this, "enabled");
			this.onEnterFrame=function(){
				if(this._currentframe == this._totalframes){
					delete this.onEnterFrame; 
				} else {
					this.nextFrame();
				}
				return;
			}
		} else {
			this.onEnterFrame=function(){
				if(this._currentframe == 1) {
					delete this.onEnterFrame;
					this.listener.onChange(this, "enabled");
				} else {
					this.prevFrame();
				}
				return;
			};
		}
		return;
	};
	
	public function setWindow(w:String):Void {
		this.window = w;
		return;
	}
	public function getWindow():String { return this.window; }
	
}